package com.idanchuang.support.etcache.local;

import java.util.Objects;

/**
 * @author yjy
 * Created at 2021/12/22 4:44 下午
 */
public class LocalKey<K> {

    /**
     * 是否压测 0否 1是
     */
    private int pressure;
    /**
     * 原始key
     */
    private K key;

    public LocalKey() {
    }

    public LocalKey(int pressure, K key) {
        this.pressure = pressure;
        this.key = key;
    }

    public int getPressure() {
        return pressure;
    }

    public void setPressure(int pressure) {
        this.pressure = pressure;
    }

    public K getKey() {
        return key;
    }

    public void setKey(K key) {
        this.key = key;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        LocalKey<?> localKey = (LocalKey<?>) o;
        return pressure == localKey.pressure
                && Objects.equals(key, localKey.key);
    }

    @Override
    public int hashCode() {
        return Objects.hash(pressure, key);
    }
}
